home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 14 / Mac Magazin and MacEasy Magazine CD - Issue 14.iso / Wissenschaft & Technik / StandardGetFolder 2.0 / StandardGetFolder.h next >
Text File  |  1995-07-04  |  3KB  |  95 lines

  1. /****************************************************************************************************
  2.  
  3. StandardGetFolder.h -- Copyright Chris Larson, 1993 - 1994 -- All rights reserved.
  4.                        Based partly upon a StandardGetFolder example by Steve Falkenburg (MacDTS)
  5.                        and partly on the code in Inside Macintosh: Files.
  6.                        
  7.                        Dialog box layouts taken from Inside Macintosh: Files.
  8.                        
  9.  Include this file in your #includes to use StandardGetFolder.
  10.  
  11.     Bug Reports/Comments to larson@kingston.cs.ucla.edu
  12.  
  13.     Version 2.0
  14.  
  15.   Usage Rules:  This package (source code and compiled derivatives) may be used in any shareware
  16.                 product (or other such stuff: freeware, beerware, postcardware, etc.) as long as you
  17.                 mention me in your credits. (A registered copy of whatever you write wouldn’t hurt
  18.                 either ;-) This package is _not_ in the public domain and may _not_ be used in any
  19.                 public domain product in any fashion. This package may not be used in any commercial
  20.                 product without the expressed, written consent of the author.
  21.  
  22. ****************************************************************************************************/
  23.  
  24. #ifndef __STANDARDGETFOLDER__
  25. #define __STANDARDGETFOLDER__
  26.  
  27. // ----------
  28. // Constants
  29. // ----------
  30.  
  31. #define kSGFHideNewFolderButton        0x0010
  32.  
  33. #define kSGFNeedSearchPrivs            0x0001
  34. #define kSGFNeedReadPrivs            0x0002
  35. #define kSGFNeedWritePrivs            0x0004
  36.  
  37. #define kSGFSelectDropFolder        kSGFNeedWritePrivs
  38. #define kSGFNeedAllPrivs            ( kSGFNeedSearchPrivs + kSGFNeedReadPrivs + kSGFNeedWritePrivs )
  39. #define kSGFDefaultFlags            kSGFNeedAllPrivs
  40.  
  41. // ----------
  42. // Type Declarations
  43. // ----------
  44.  
  45. #pragma options align=mac68k
  46. typedef struct {
  47.  
  48.     short        sfGood;
  49.     short        sfVRefNum;
  50.     long        sfDirID;
  51.  
  52. } StandardFolderReply, *StandardFolderReplyPtr, **StandardFolderReplyHandle;
  53. #pragma options align=reset
  54.  
  55. // ----------
  56. // Definitions for the callback event handling function.
  57. // ----------
  58.  
  59. typedef pascal void (*WindowEventHandler)(EventRecord*);
  60.  
  61. #if GENERATINGCFM
  62. typedef UniversalProcPtr    WindowEventHandlerUPP;
  63. #else
  64. typedef    WindowEventHandler    WindowEventHandlerUPP;
  65. #endif
  66.  
  67. enum {
  68.     uppWindowEventHandlerProcInfo = kPascalStackBased
  69.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  70. };
  71.  
  72. #if GENERATINGCFM
  73. #define    NewWindowEventHandlerProc(userRoutine)            (WindowEventHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowEventHandlerProcInfo, GetCurrentArchitecture())
  74. #define CallWindowEventHandler(userRoutine,theEventPtr)    (void)CallUniversalProc((UniversalProcPtr)(userRoutine),uppWindowEventHandlerProcInfo,(theEventPtr))
  75. #else
  76. #define NewWindowEventHandlerProc(userRoutine)            ((WindowEventHandlerUPP)(userRoutine))
  77. #define CallWindowEventHandler(userRoutine,theEventPtr)    (*(userRoutine))((theEventPtr))
  78. #endif
  79.  
  80. // ----------
  81. // Function Prototypes
  82. // ----------
  83.  
  84. #ifdef __cplusplus
  85. extern "C" {
  86. #endif
  87.  
  88. pascal OSErr StandardGetFolder(ConstStr255Param prompt, StandardFolderReplyPtr reply, short flags, WindowEventHandlerUPP windowEventProc);
  89.  
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93.  
  94. #endif
  95.